<html>
<head><meta charset="utf-8"><title>How to abort codegen on post-monomorphization error? · t-compiler/wg-llvm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/index.html">t-compiler/wg-llvm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/How.20to.20abort.20codegen.20on.20post-monomorphization.20error.3F.html">How to abort codegen on post-monomorphization error?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224326997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/How%20to%20abort%20codegen%20on%20post-monomorphization%20error%3F/near/224326997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/How.20to.20abort.20codegen.20on.20post-monomorphization.20error.3F.html#224326997">(Jan 28 2021 at 13:45)</a>:</h4>
<p>I could use some help with <a href="https://github.com/rust-lang/rust/pull/81327">https://github.com/rust-lang/rust/pull/81327</a>... I am looking for a way to abort codegen when a post-monomorphization error was triggered, but no matter what I do I run into LLVM assertion failures (or weird MSVC hangs, it seems).</p>



<a name="224327462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/How%20to%20abort%20codegen%20on%20post-monomorphization%20error%3F/near/224327462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/How.20to.20abort.20codegen.20on.20post-monomorphization.20error.3F.html#224327462">(Jan 28 2021 at 13:49)</a>:</h4>
<p>I am already looking into this.</p>



<a name="224328113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/How%20to%20abort%20codegen%20on%20post-monomorphization%20error%3F/near/224328113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/How.20to.20abort.20codegen.20on.20post-monomorphization.20error.3F.html#224328113">(Jan 28 2021 at 13:54)</a>:</h4>
<p>In <code>codegen_crate</code> you can check for <code>tcx.sess.has_errors()</code> and then I think only call <code>submit_codegened_module_to_llvm</code> if there are no errors. At the end of the loop you can then add a <code>tcx.sess.abort_if_errors()</code>. This should prevent any module from being optimized and written while still codegening them all for the errors.</p>



<a name="224328135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/How%20to%20abort%20codegen%20on%20post-monomorphization%20error%3F/near/224328135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/How.20to.20abort.20codegen.20on.20post-monomorphization.20error.3F.html#224328135">(Jan 28 2021 at 13:54)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> ^</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>